#pragma once
#include"InetAddr.hpp"
#include<functional>
#include"Reactor.hpp"
class Reactor;
class Connection;
using handler_t =std::function<std::string(std::string&)>;

class Connection
{
    public:
    Connection():_events(0),_owner(nullptr)
    {

    }
    void SetEvents(const uint32_t& events)
    {
        _events=events;
    }
    void SetOwner(Reactor* owner)
    {
        _owner=owner;
    }
    uint32_t GetEvents()
    {
        return _events;
    }
    Reactor* GetOwner()
    {
        return _owner;
    }
    void SetHandler(handler_t handler)
    {
        _handler=handler;
    }
    virtual void Recver()=0;
    virtual void Sender()=0;
    virtual void Excepter()=0;
    virtual int GetSockFd()=0;
    ~Connection()
    {

    }
    handler_t _handler;
    private:
    uint32_t _events;
    Reactor* _owner;
};